/**
 * ProductDownload 业务逻辑实现类
 * @author yanwl
 * @date 2014-08-25
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.ProductDownload;
import com.chnbst.bstyun.model.vo.ProductDownloadVo;
import com.chnbst.bstyun.service.ProductDownloadService;

@Transactional
@Service
public class ProductDownloadServiceImpl extends BaseService implements ProductDownloadService {
	
	//声明命名空间
	private final static String nameSpace = "com.chnbst.bstyun.mapper.ProductDownloadMapper";
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteProductDownload(Integer productDownloadId) {
		return DaoHelper.delete(nameSpace, "deleteProductDownload", productDownloadId);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertProductDownload(ProductDownload productDownload) {
		return DaoHelper.insert(nameSpace, "insertProductDownload", productDownload);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateProductDownload(ProductDownload productDownload) {
		return DaoHelper.update(nameSpace, "updateProductDownload", productDownload);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public ProductDownload selectProductDownloadByProductDownloadId(Integer productDownloadId) {
		return (ProductDownload)DaoHelper.query(nameSpace, "selectProductDownloadByProductDownloadId", productDownloadId);
	}
	
	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<ProductDownloadVo> selectProductDownloadVos(Map<String, Object> map) {
		return (List<ProductDownloadVo>)DaoHelper.list(nameSpace, "selectProductDownloadVos", map);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public int selectProductDownloadCount(Map<String, Object> map) {
		return DaoHelper.count(nameSpace, "selectProductDownloadCount", map);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public ProductDownload selectProductDownloadByProductIdAndDownloadWayId(
			Map<String, Object> map) {
		return (ProductDownload)DaoHelper.query(nameSpace, "selectProductDownloadByProductIdAndDownloadWayId", map);
	}
}
